package com.test.dao.impl;

import com.test.dao.IBuildMeterDao;
import com.test.model.BuildMeter;
import com.test.model.House;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by ZZF on 2017/7/30.
 */
@Repository
public class BuildMeterDaoImpl extends BaseDaoImpl<BuildMeter> implements IBuildMeterDao {
    @Override
    public List<House> findHouses(int unitId) {

        String sql="SELECT b.* FROM `rcc_e_buildmeter` a INNER JOIN g_house b " +
                "ON a.unitId=b.unitId WHERE a.unitId="+unitId;

        Query query = getSession().createSQLQuery(sql).addEntity(House.class);

        return query.list();

    }
}
